<script lang="ts" name="EmotionalStateScreening" setup>
import dDialog from '@/components/dDialog/dDialog.vue'
import {ref} from 'vue'
import {useRoute} from 'vue-router'
const route = useRoute()
// 禁止编辑
const disEdit = ref<boolean>(Boolean(route.query.disEdit))

const props = defineProps({
  //显示
  showDialog: {
    type: Boolean,
    required: true
  },
  // 老年人情感状态初筛
  odEmotionState: {
    type: Number,
    required: true
  }
})

const emits = defineEmits(['close', 'confirm'])

// 老年人情感状态-粗筛
const emotionalStateScreening = ref(props.odEmotionState || 1)

/**
 * @description: 关闭弹窗
 * @return {*}
 */
const onCancel = () => {
  emits('close')
}
/**
 * @description: 关闭弹窗
 * @return {*}
 */
const onClose = () => {
  emits('close')
}

/**
 * @description: 保存
 * @return {*}
 */
const onConfirm = () => {
  emits('confirm', emotionalStateScreening.value)
  emits('close')
}
</script>
<template>
  <d-dialog
    title="老年人情感状态-粗筛"
    :show-dialog="showDialog"
    :width="600"
    :hide-save-btn="disEdit"
    @cancel="onCancel"
    @close="onClose"
    @confirm="onConfirm"
  >
    <div class="title">
      询问被检查者“你经常感到伤心或抑郁吗”或“你的情绪怎么样”。
    </div>
    <div class="title">
      如回答“是”或“我想不是十分好”，为粗筛阳性，需进一步“老年抑郁量表”检查
    </div>
    <span class="result">情感状态</span>
    <el-radio-group v-model="emotionalStateScreening" :disabled="disEdit">
      <el-radio :label="1">
        良好
      </el-radio>
      <el-radio :label="2">
        不佳
      </el-radio>
    </el-radio-group>
  </d-dialog>
</template>

<style scoped lang="less">
.title {
  font-weight: bold;
  margin: 5px 0;
}
.result {
  margin-right: 25px;
  display: inline-block;
  height: 32px;
  line-height: 32px;
}
</style>
